Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-string keys when rewriting assertDictContainsSubset #55

Closed
wants to merge 5 commits into from

Conversation

verhovsky
Copy link

@verhovsky verhovsky commented May 31, 2021

and also update supported Python versions in tox.ini.

#54

@verhovsky
Copy link
Author

verhovsky commented Jun 1, 2021

I guess {**a, **b} is not supported on Python 2. One tricky thing is that dict(a, **b) actually works in Python 2. We will have to either drop Python 2 support or have a flag like --py2 (and --py3?) to enable that. While we're doing this, we might as well add a --py39 because on 3.9 you can do a | a == a.

@nicoddemus
Copy link
Member

Thanks @verhovsky!

My 2 cents:

I think dropping Python 2 is fine, and then we always use the Python 3 syntax ({**a, **b}).

If not, not sure we need a flag, we might just use the version of the Python we are running (sys.version_info).

@verhovsky
Copy link
Author

verhovsky commented Jun 2, 2021

use the version of the Python we are running

If someone doesn't realize their pip command is Python 2 pip and does pip install unittest2pytest, they will run into this bug when they run unittest2pytest <whatever>. In a way dropping Python 2 support has the same effect, since installing unittest2pytest under Python 2 will install the last version, which is the one that rewrites it as dict(b, **a).

I also dropped Python 3.5 which is unsupported since 2020-09, I hope that's fine.

@nicoddemus
Copy link
Member

LGTM!

This also warrants a changelog entry. 👍

@verhovsky verhovsky requested a review from nicoddemus June 8, 2021 12:50
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@nicoddemus nicoddemus deleted the branch pytest-dev:develop December 7, 2024 15:18
@nicoddemus nicoddemus closed this Dec 7, 2024
@nicoddemus
Copy link
Member

Created follow up in #73.

Sorry @verhovsky for the long delay here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants